package com.wd.live.view.activity;

import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.Observer;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.wd.live.R;
import com.wd.live.base.BaseActivity;
import com.wd.live.bean.YueBean;
import com.wd.live.databinding.ActivityMywalletBinding;
import com.wd.live.model.SpUtils;
import com.wd.live.viewmodel.MainViewModel;
import com.wd.live.viewmodel.MyMoneyViewModel;

import java.util.HashMap;
import java.util.Map;

public class MywalletActivity extends BaseActivity<MyMoneyViewModel,ActivityMywalletBinding> {


    @Override
    protected void initData() {
        Map<String, Object> map = new HashMap<>();
        String uid = SpUtils.getString("uid", "");
        String sid = SpUtils.getString("sid", "");
        int userid = Integer.parseInt(uid);
        map.put("sessionId",sid);
        map.put("userId",userid);
        viewmodel.getyuelist(map).observe(MywalletActivity.this, new Observer<YueBean>() {
            @Override
            public void onChanged(YueBean yueBean) {

                databind.qianshu.setText(yueBean.getBalance());
            }
        });


        databind.mywalletChongzhi.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MywalletActivity.this,ChongActivity.class));
            }
        });
    }

    @Override
    protected int initLayout() {
        return R.layout.activity_mywallet;
    }

    @Override
    public void onChanged(Object o) {

    }
}